
<div class="form">
	<p></p>
	<form id="ndk-health-form" method="post" action="<?php echo Yii::app()->createUrl('soa/showBank'); ?>" target="_blank">
		<div class="row">
			<div class="col-md-4">
				<div class="widget box">

					<div class="widget-header">
						<h4><i class="icon-reorder"></i> Report Bank </h4>
					</div>


					<div class="widget-content">
						

						<div class="control-group">
						<label class="control-label">Bank</label>
						<div class="controls">
							<?php 
echo CHtml::dropDownList('cb_coa', '', CHtml::listData(MstCoa::model()->findAll(' id >=11 AND id <=16 order by code'), 'id','name'),array("class"=>"form-control","id"=>"cb_coa"));							?>
						</div>
						</div>


						<div class="control-group">
						<label class="control-label">Periode</label>
						<div class="controls">
						<input id="tgl_awal" class="form-control input-width-small" data-mask="99-99-9999" type="text" name="tgl_awal" size="100" style="float:left"> <label>s/d </label>
						<input id="tgl_akhir" class="form-control input-width-small" data-mask="99-99-9999" type="text" name="tgl_akhir" size="100">
						</div>
						</div>

					</div>

				</div>
			</div>
		</div>

		<div class="row">
			<div class="col-md-4">
				<div class="form-actions">
				<button class="btn btn-primary btn-large" id="btn_prev" type="button">Preview</button> 
					<button class="btn btn-primary btn-large" name="yt0" type="submit">Cetak</button>
				</div>
			</div>
		</div>
	</form>

</div>



<div class="form">
<table class="table table-hover table-striped table-bordered table-highlight-head" id="tbl_bank">
	<thead>
		<tr>
			<th style="text-align:center">Date</th>
			<th style="text-align:center">No. Voucher</th>
			<th style="text-align:center">Payment To</th>
			<th style="text-align:center">Curr.</th>
			<th style="text-align:center">Credit</th>
			<th style="text-align:center">Signature</th>
		</tr>
	</thead>
	<tbody id="body_isi">
	
	</tbody>
	
</div>



<script type="text/javascript">
function formatCurrency(total) {
    var neg = false;
    if(total < 0) {
        neg = true;
        total = Math.abs(total);
    }
    return (neg ? "" : '') + parseFloat(total, 10).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,").toString();
}

$("#btn_prev").click(function(e){
	var isi_cicilan = "";
	$.ajax({
			type:"POST",
            url:"<?php echo Yii::app()->createUrl('/Soa/showBank'); ?>",
			data:{"cb_coa":$("#cb_coa").val()},
			dataType:"json",
            success:function(data){
				$("#body_isi").html("");
				
				for(var i=0;i<data.length;i++){
						$("#body_isi").append("<tr>" +
						"<td>"+data[i].tgl_transaksi+"</td>"+
						"<td>"+data[i].nota_note+"</td>"+
						"<td>"+data[i].client_name+"</td>"+
						"<td>"+data[i].jns_mata_uang+"</td>"+
						"<td align='right'> "+formatCurrency(data[i].credit)+"</td>"+
						"<td> </td>"+
						"</tr>");
						
				}
				
				
			}
	});
});//end click
</script>